package com.qwert.shortlink.admin.controller.remote;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qwert.shortlink.admin.common.convention.result.Result;
import com.qwert.shortlink.admin.remote.dto.ShortLinkRemoteService;
import com.qwert.shortlink.admin.remote.dto.req.shortlink.ShortLinkCreateReqDTO;
import com.qwert.shortlink.admin.remote.dto.req.shortlink.ShortLinkPageReqDTO;
import com.qwert.shortlink.admin.remote.dto.req.shortlink.ShortLinkUpdateReqDTO;
import com.qwert.shortlink.admin.remote.dto.resp.shortlink.ShortLinkCreateRespDTO;
import com.qwert.shortlink.admin.remote.dto.resp.shortlink.ShortLinkPageRespDTO;
import org.springframework.web.bind.annotation.*;

/**
 * @author qwert
 * @version 1.0.0
 * @create 2024/7/3 9:54
 **/
@RestController
@RequestMapping("/api/shortlink/admin")
public class ShortLinkController {

    ShortLinkRemoteService shortLinkRemoteService = new ShortLinkRemoteService() {
    };

    @GetMapping("/v1/page")
    public Result<IPage<ShortLinkPageRespDTO>> pageShortLink(ShortLinkPageReqDTO shortLinkPageReqDTO){
        return shortLinkRemoteService.pageShortLink(shortLinkPageReqDTO);
    }

    @PostMapping("/v1/create")
    public Result<ShortLinkCreateRespDTO> createShortLink(@RequestBody ShortLinkCreateReqDTO shortLinkCreateReqDTO){
        return shortLinkRemoteService.createShortLink(shortLinkCreateReqDTO);
    }

    @PostMapping("/v1/update")
    public Result<Integer> updateShortLink(@RequestBody ShortLinkUpdateReqDTO shortLinkUpdateReqDTO){
        return shortLinkRemoteService.updateShortLink(shortLinkUpdateReqDTO);
    }

//    @GetMapping("/v1/count")
//    public Result<List<ShortLinkCountRespDTO>> listGroupShortLinkCount(@RequestParam("gids") List<String> gids){
//        return shortLinkRemoteService.listGroupShortLinkCount(gids);
//    }
}
